package com.hankyung.dao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;

public abstract class DaoManager {
	private boolean isl=true;
	public boolean isIsl() {
		return isl;
	}
	public void setIsl(boolean isl) {
		this.isl = isl;
	}
	public void log(String msg){
		if(isl){
			System.out.println(this.getClass()+": "+msg+" : "+new Date());
		}
	}
	public void log(String msg, Exception e){
		if(isl){
			System.out.println(this.getClass()+": "+msg+" : "+e);
		}
	}
	public DaoManager() {
		 init();
	}
	
	private void init(){
		try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
			log("1/6 S");
		} catch (ClassNotFoundException e) {
			log("1/6 F", e);
		}
	}//
	
	public abstract Connection  getConnection() throws SQLException;
	
	public void close(Connection conn, Statement psmt, ResultSet rs){
		if(rs!=null){
			try {
				rs.close();
			} catch (SQLException e) {
			}
		}
		if(psmt!=null){
			try {
				psmt.close();
			} catch (SQLException e) {
			}
		}
		if(conn!=null){
			try {
				conn.close();
			} catch (SQLException e) {
			}
		}
	}//
}//















